package com.xiangxiao.rpan.gateway.enums;

/**
 * @auther xiangxiao
 * @email 573768011@qq.com
 * @data 2023/2/13 17:30
 */
public enum HttpStatusCode {
  //成功
  SUCCESS(200),
  NOT_FOUND(404),
  BAD_REQUEST(400),
  UNAUTHORIZED(401),
  FORBIDDEN(403);

  private int respCode;

  HttpStatusCode(int respCode) {
    this.respCode = respCode;
  }

  public int getRespCode() {
    return respCode;
  }

  public String getCodeMsg(){
    String msg = "";
    switch (this) {
      case SUCCESS:
        msg = "请求成功";
        break;
      case NOT_FOUND:
        msg = "请求页面不存在";
        break;
      case BAD_REQUEST:
        msg = "错误请求";
        break;
      case UNAUTHORIZED:
        msg = "未授权";
        break;
      case FORBIDDEN:
        msg = "禁止";
        break;
      default:
        break;
    }
    return msg;
  }
}
